
#CROSS=

CC=$(CROSS)gcc
CPP=$(CROSS)g++
STRIP=$(CROSS)strip

TARGET_INSTALL_DIR=./

DEMO= $(TARGET_INSTALL_DIR)/app

.PHONY: all after-all

all: $(DEMO) after-all

after-all :
	rm -rf *.o

HV_LD_PATH= ../libhv/build/lib
HV_LD_LIBS= -L$(HV_LD_PATH) -lhv
HV_INCLUDE_PATH=-I ../libhv/build/include/

LD_LIBS = $(HV_LD_LIBS)

INCLUDE = $(HV_INCLUDE_PATH)

CXXFLAGS = $(LD_LIBS) $(INCLUDE) -O2 -std=c++11 -lrt -pthread -lpthread -ldl -lm -Wall -DBSD=1

TGT = $(SRC_C:.c=.o) $(SRC_CPP:.cpp=.o)

SRC_C = $(wildcard *.c)
SRC_CPP = $(wildcard *.cpp)


$(DEMO) : $(TGT) 
	$(CPP) $(TGT) $(CXXFLAGS) -Wall -o $(DEMO)
	$(STRIP) $(DEMO)


%.o:%.c
	$(CC) -c $? -s $(CXXFLAGS) -fPIC -o ./$@
%.o:%.cpp
	$(CPP) -c $? -s $(CXXFLAGS) -fPIC -o ./$@

clean :
	rm -rf *.o *.so $(DEMO)

